package me.cloudcat.develop.controller;

import me.cloudcat.develop.mongodb.MongoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

@Controller
public class MongodbController {

  @Autowired
  MongoService test;

  @RequestMapping(value = "/testOne", method = RequestMethod.GET)
  public String testOne(Model model, HttpServletRequest request) {
    test.testQuery();

    return "login";
  }

  @RequestMapping(value = "/testTwo", method = RequestMethod.GET)
  public String testTwo(Model model, HttpServletRequest request) {
    test.testSave();
    return "login";
  }

  @RequestMapping(value = "/testThree", method = RequestMethod.GET)
  public String testThree(Model model, HttpServletRequest request) {
    test.testSaveWithTemplate();
    return "login";
  }

  @RequestMapping(value = "/testFour", method = RequestMethod.GET)
  public String testFour(Model model, HttpServletRequest request) {
    test.testUpdateWithTemplate();
    return "login";
  }

  @RequestMapping(value = "/testFive", method = RequestMethod.GET)
  public String testFive(Model model, HttpServletRequest request) {
    test.testDeleteWithTemplate();
    return "login";
  }
}
